home *** CD-ROM | disk | FTP | other *** search
/ The Netherlands - A Compact World / The Netherlands.iso / chapters / 8.3.dxr / 00034_V2 tekstimport2 met MAC, MacChars, Edit, Tekstkleur EN LINKS!!.ls < prev    next >
Encoding:
Text File  |  2004-06-15  |  4.2 KB  |  125 lines

  1. property spriteNum, pWoordenlijst
  2. global taalkeuze, maclist, tekstkleur, woordenteller
  3.  
  4. on vertalen me
  5.   sprite(spriteNum).visibility = 0
  6.   if tekstkleur = VOID then
  7.     sprite(spriteNum).member.foreColor = 235
  8.   else
  9.     sprite(spriteNum).member.foreColor = tekstkleur
  10.   end if
  11.   if taalkeuze = VOID then
  12.     taalkeuze = "nl"
  13.   end if
  14.   tekstpad = "@txt:" & taalkeuze & ":"
  15.   fieldnaam = sprite(spriteNum).member.name
  16.   bestandnaam = fieldnaam & ".txt"
  17.   pWoordenlijst = []
  18.   woordenteller = 1
  19.   buffer = new(xtra("fileio"))
  20.   openFile(buffer, tekstpad & bestandnaam, 1)
  21.   setPosition(buffer, 0)
  22.   bufferinhoud = readFile(buffer)
  23.   closeFile(buffer)
  24.   put bufferinhoud into member fieldnaam
  25.   repeat with Tellertje8 = 1 to member(fieldnaam).text.length
  26.     if member(fieldnaam).char[Tellertje8] = numToChar(10) then
  27.       put EMPTY into (member fieldnaam).char[Tellertje8]
  28.     end if
  29.     if member(fieldnaam).char[Tellertje8].charToNum > 127 then
  30.       if the platform contains "Mac" then
  31.         put numToChar(maclist[member(fieldnaam).char[Tellertje8].charToNum - 127]) into (member fieldnaam).char[Tellertje8]
  32.       end if
  33.     end if
  34.     if member(fieldnaam).char[Tellertje8] = "#" then
  35.       put EMPTY into (member fieldnaam).char[Tellertje8]
  36.       invoercharacter = EMPTY
  37.       linkbeschrijving = EMPTY
  38.       repeat while invoercharacter <> "|"
  39.         invoercharacter = member(fieldnaam).char[Tellertje8]
  40.         linkbeschrijving = linkbeschrijving & invoercharacter
  41.         put EMPTY into (member fieldnaam).char[Tellertje8]
  42.       end repeat
  43.       put EMPTY into linkbeschrijving.char[the length of linkbeschrijving]
  44.       startselectie = Tellertje8 + 2
  45.       repeat while invoercharacter <> "#"
  46.         Tellertje8 = Tellertje8 + 1
  47.         invoercharacter = member(fieldnaam).char[Tellertje8]
  48.         if member(fieldnaam).char[Tellertje8] = numToChar(10) then
  49.           put EMPTY into (member fieldnaam).char[Tellertje8]
  50.         end if
  51.         if member(fieldnaam).char[Tellertje8] = numToChar(32) then
  52.           woordenteller = woordenteller + 1
  53.         end if
  54.         if member(fieldnaam).char[Tellertje8].charToNum > 127 then
  55.           if the platform contains "Mac" then
  56.             put numToChar(maclist[member(fieldnaam).char[Tellertje8].charToNum - 127]) into (member fieldnaam).char[Tellertje8]
  57.           end if
  58.         end if
  59.       end repeat
  60.       eindeselectie = Tellertje8 - 1
  61.       put EMPTY into (member fieldnaam).char[Tellertje8]
  62.       link(me, startselectie, eindeselectie, linkbeschrijving, fieldnaam)
  63.     end if
  64.   end repeat
  65.   repeat with i = 1 to pWoordenlijst.count
  66.     if pWoordenlijst[i] <> 0 then
  67.       set the foreColor of word i of member fieldnaam to 214
  68.     end if
  69.   end repeat
  70.   sprite(spriteNum).visibility = 1
  71. end
  72.  
  73. on beginSprite me
  74.   sendSprite(spriteNum, #vertalen)
  75. end
  76.  
  77. on link me, start, eind, linkbeschrijving, fieldnaam
  78.   tijdelijkpunt = member(fieldnaam).charPosToLoc(start)
  79.   tijdelijkpunt.locH = tijdelijkpunt.locH + sprite(spriteNum).left
  80.   tijdelijkpunt.locV = tijdelijkpunt.locV + sprite(spriteNum).top
  81.   startwoord = sprite(spriteNum).pointToWord(tijdelijkpunt)
  82.   tijdelijkpunt = member(fieldnaam).charPosToLoc(eind)
  83.   tijdelijkpunt.locH = tijdelijkpunt.locH + sprite(spriteNum).left
  84.   tijdelijkpunt.locV = tijdelijkpunt.locV + sprite(spriteNum).top
  85.   eindwoord = sprite(spriteNum).pointToWord(tijdelijkpunt)
  86.   repeat with woord = startwoord to eindwoord
  87.     pWoordenlijst.addAt(woord, linkbeschrijving)
  88.   end repeat
  89. end
  90.  
  91. on mouseWithin me
  92.   staticmouseword = the mouseWord
  93.   if (staticmouseword <= pWoordenlijst.count) and (staticmouseword > 0) then
  94.     if pWoordenlijst[staticmouseword] <> 0 then
  95.       cursor(280)
  96.     else
  97.       cursor(-1)
  98.     end if
  99.   end if
  100. end
  101.  
  102. on mouseLeave me
  103.   cursor(-1)
  104. end
  105.  
  106. on mouseUp me
  107.   global naam
  108.   staticmouseword = the mouseWord
  109.   put the mouseWord
  110.   if (staticmouseword <= pWoordenlijst.count) and (staticmouseword > 0) then
  111.     if pWoordenlijst[staticmouseword] <> 0 then
  112.       if pWoordenlijst[staticmouseword].char[1] = "@" then
  113.         naam = pWoordenlijst[staticmouseword]
  114.         put EMPTY into naam.char[1]
  115.         tell the stage
  116.           wisseltje()
  117.         end tell
  118.       else
  119.         put pWoordenlijst[staticmouseword]
  120.         do(pWoordenlijst[staticmouseword])
  121.       end if
  122.     end if
  123.   end if
  124. end
  125.